import http from '@/base/http';
import {
  OrderRecordVO,
  ReportRecordItem,
  UserAddressVO,
  UserVipTimeVO,
  UserVO,
  VirtualNumberVO,
  WxMyPageVO,
} from './types';
import { HttpResponse } from '../../types';

/**
 * userInfo
 */
enum API_USERINFO {
  Collection = '/wx/demand/userCollectionPage', // 我的收藏
  PointsRecord = '/wx/userPointsRecord/page', // 分页查询用户积分变动记录表
  collection = '/wx/demand/userCollectionPage', // 我的收藏
  UserAddress = '/wx/userAddress/create', // 新增用户收货地址表
  UpdateAddress = '/wx/userAddress/update', // 修改用户收货地址表
  UserAddressList = '/wx/userAddress/page',
  UserInfo = '/wx/user/wxMyPage',
  UpdateUserInfo = '/wx/user/setUserInfo',
  IndustryEnumList = '/wx/user/industryEnumList',
  GetUserInfo = '/login/getUserInfo',
  CreateReportRecord = '/wx/reportRecord/create', // 新增举报记录表
  CreateCityPartnerApplication = '/wx/cityPartnerApplication/create',
  CityPartnerApplicationPage = '/wx/cityPartnerApplication/page',
  ReportRecordList = '/wx/reportRecord/page', // 分页查询举报记录表
  GetUserExtraPhonesInfo = '/wx/user/getUserExtraPhonesInfo', // 修改联系电话页面数据
  UpdateUserExtraPhones = '/wx/user/setUserExtraPhones', // 修改联系电话
  CreateInvoiceRecord = '/wx/invoiceRecord/create', // 新增发票
  SelectOrderByUserId = '/wx/invoiceRecord/selectOrderByUserId', // 查询用户订单记录表
  GetUserVipInfo = '/wx/userVipTime/getById', // 查询用户VIP信息
  VipMember = '/login/vip-member',
  GetMyPubLish = '/wx/demand/userPage', // 我的发布
  RefreshTop = '/wx/demand/refreshTop', // 刷新置顶
  TakeOffShelves = '/wx/demand/takeOffShelves', // 下架
  DeleteDemand = '/wx/demand/delete', // 删除我的发布
  GetFriendStatus = '/friend/getFriendStatus', // 获取好友状态
  GetUserHome = '/wx/user/userHome', // 个人空间信息
}

export function takeOffShelves(data: unknown): Promise<any> {
  return http.put(API_USERINFO.TakeOffShelves, data);
}

export function refreshTop(data: unknown): Promise<any> {
  return http.put(API_USERINFO.RefreshTop, data);
}

export function getMyPubLish(data: unknown): Promise<any> {
  return http.get(API_USERINFO.GetMyPubLish, data);
}

export function userCollectionPage(data: unknown): Promise<any> {
  return http.get(API_USERINFO.collection, data);
}

export function userPointsRecord(data: unknown): Promise<any> {
  return http.get(API_USERINFO.PointsRecord, data);
}

export function createUserAddress(data: unknown): Promise<any> {
  return http.post(API_USERINFO.UserAddress, data);
}

export function updateUserAddress(data: unknown): Promise<any> {
  return http.put(API_USERINFO.UpdateAddress, data);
}

export function UserAddressList(data: unknown): Promise<HttpResponse<UserAddressVO[]>> {
  return http.get(API_USERINFO.UserAddressList, data);
}

export function getMyPageUserInfo(): Promise<WxMyPageVO> {
  return http.get(API_USERINFO.UserInfo);
}

export function updateUserInfo(data: unknown): Promise<any> {
  return http.post(API_USERINFO.UpdateUserInfo, data);
}

export function getIndustryEnumList(): Promise<WxMyPageVO> {
  return http.get(API_USERINFO.IndustryEnumList);
}

export function getUserInfo(): Promise<HttpResponse<UserVO>> {
  return http.get(API_USERINFO.GetUserInfo);
}

export function createReportRecord(data: unknown): Promise<any> {
  return http.post(API_USERINFO.CreateReportRecord, data);
}

export function createCityPartnerApplication(data: unknown): Promise<any> {
  return http.post(API_USERINFO.CreateCityPartnerApplication, data);
}

export function getCityPartnerApplication(data: unknown): Promise<HttpResponse<any[]>> {
  return http.get(API_USERINFO.CityPartnerApplicationPage, data);
}

export function getReportRecordList(data: unknown): Promise<HttpResponse<ReportRecordItem[]>> {
  return http.get(API_USERINFO.ReportRecordList, data);
}

export function getUserExtraPhonesInfo(): Promise<HttpResponse<VirtualNumberVO>> {
  return http.get(API_USERINFO.GetUserExtraPhonesInfo);
}
export function updateUserExtraPhones(data: unknown): Promise<any> {
  return http.post(API_USERINFO.UpdateUserExtraPhones, data);
}
export function createInvoiceRecord(data: unknown): Promise<any> {
  return http.post(API_USERINFO.CreateInvoiceRecord, data);
}
export function getSelectOrderByUserId(): Promise<HttpResponse<OrderRecordVO[]>> {
  return http.get(API_USERINFO.SelectOrderByUserId);
}
export function getUserVipInfo(): Promise<HttpResponse<UserVipTimeVO>> {
  return http.get(API_USERINFO.GetUserVipInfo);
}

export function getUserVipMember(): Promise<any> {
  return http.get(API_USERINFO.VipMember);
}

export function deleteDemand(data: unknown): Promise<HttpResponse<any>> {
  return http.delete(API_USERINFO.DeleteDemand, data);
}

export function friendStatus(data: unknown): Promise<HttpResponse<any>> {
  return http.get(API_USERINFO.GetFriendStatus, data);
}

export function getUserHome(data: unknown): Promise<HttpResponse<any>> {
  return http.get(API_USERINFO.GetUserHome, data);
}
